Skip to content

Add BoringSSL support to the ja4_fingerprint plugin#12914

Merged
maskit merged 25 commits intoapache:masterfrom
maskit:ja4_boringssl_noalloc
Mar 4, 2026
Merged

Add BoringSSL support to the ja4_fingerprint plugin#12914
maskit merged 25 commits intoapache:masterfrom
maskit:ja4_boringssl_noalloc

Conversation

@maskit
Copy link
Member

@maskit maskit commented Feb 25, 2026

This PR is based on #12790, and most work was done by @jasmine-nahrain. Please look at the PR for the overall description. I made additional changes to eliminate the heap allocations that were introduced on the PR.

Additional changes:

  • Removed the container that holds copies of items in ClientHello
  • Made TSVConnClientHelloGet returns a object by value instead of a pointer
  • Removed TSClientHelloDestroy since the returned value is no longer a pointer
  • Changed the type of TSExtensionTypeList to a custom class that supports range-based for-loop (this eliminates the use of std::vector).

Changes for the plugin code are trivial:

  • Check the availability of TSClientHello by is_available() instead of comparing with nullptr
  • Change -> to . since TSClientHello is no longer a pointer
  • Remove the call for TSClientHelloDestroy

Now all getters access the original data in a library specific data structure. Plugin developers can copy things by themselves if they need to. At a minimum, it's not necessary for this (ja4) plugin.

The internal implementation is getting a little messy. I think TLSSNISupport::ClientHello should be decoupled from TLSSNISupport, but the change wouldn't affect the plugin API, so we can do it later.

@maskit maskit force-pushed the ja4_boringssl_noalloc branch from 2f7802f to eaf9582 Compare February 25, 2026 18:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds BoringSSL support to the ja4_fingerprint plugin by introducing a new TSClientHello API that abstracts TLS ClientHello access across both OpenSSL and BoringSSL implementations. The changes build upon PR #12790 with optimizations to eliminate heap allocations by returning objects by value and using a custom iterator class instead of std::vector for extension types.

Changes:

  • Introduces TSVConnClientHelloGet() and TSClientHelloExtensionGet() plugin APIs that work with both BoringSSL and OpenSSL
  • Implements a custom TSExtensionTypeList iterator class to avoid heap allocations when accessing extension type IDs
  • Updates ja4_fingerprint plugin to use the new API, enabling BoringSSL compatibility
  • Removes the OpenSSL-only build dependency from the ja4_fingerprint plugin

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/iocore/net/TLSSNISupport.cc Implements ClientHello getters and custom iterator for extension IDs with OpenSSL/BoringSSL conditional compilation
src/iocore/net/TLSSNISupport.h Defines ClientHello class with ExtensionIdIterator and adds _ch member to store ClientHello reference
src/api/InkAPI.cc Implements TSClientHello wrapper class methods and TSVConnClientHelloGet/TSClientHelloExtensionGet APIs
include/ts/ts.h Declares new public API functions with comprehensive documentation
include/ts/apidefs.h.in Defines TSClientHello class with custom iterator wrapping internal implementation
plugins/experimental/ja4_fingerprint/plugin.cc Updates to use TSClientHello API instead of direct OpenSSL calls, enabling BoringSSL support
plugins/experimental/ja4_fingerprint/README.md Documents BoringSSL support
doc/developer-guide/api/types/TSClientHello.en.rst Developer documentation for TSClientHello type
doc/developer-guide/api/functions/TSVConnClientHelloGet.en.rst Developer documentation for API functions
doc/admin-guide/plugins/ja4_fingerprint.en.rst Administrator guide for ja4_fingerprint plugin
doc/admin-guide/plugins/index.en.rst Adds ja4_fingerprint to plugin index
cmake/ExperimentalPlugins.cmake Removes OpenSSL-specific dependency check for JA4_FINGERPRINT

@maskit maskit added this to the 11.0.0 milestone Feb 26, 2026
@maskit maskit added the Plugins label Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 12 comments.

@bneradt
Copy link
Contributor

bneradt commented Mar 3, 2026

[approve ci autest 1]

Copy link
Contributor

@bneradt bneradt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. We've been through a lot of discussion on this between the three of us.

I just have a few nit-picky @param doxygen comment requests.

include/ts/ts.h Outdated
specific callback functions. Calling this function outside of the client
hello hook may result in unavailable object being returned.

@param sslp The SSL virtual connection handle. Must not be nullptr.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@param[in] please

include/ts/ts.h Outdated
Comment on lines +1369 to +1372
@param ch The Client Hello object obtained from TSVConnClientHelloGet().
@param type The TLS extension type to retrieve.
@param out Pointer to receive the extension data buffer. Must not be nullptr.
@param outlen Pointer to receive the length of the extension data in bytes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[in], [in], [out], [out] please.

@maskit maskit merged commit 3f6f207 into apache:master Mar 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ja4_fingerprint Work related to JA4 fingerprinting Plugins TS API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants